<!--救助政策咨询登记-->
<template>
    <div ref="body">
        <Form :label-width="120" inline>

            <Form-item label="属地区划:">
                <area-linkage :areaCode.sync="queryParam.azaa0001"></area-linkage>
            </Form-item>
            <Form-item label="申请人姓名:">
                <Input v-model="queryParam.azcp0003" placeholder="" style="width:200px"/>
            </Form-item>

            <Form-item label="申请人证件号码:">
                <Input v-model="queryParam.azcp0001" placeholder="" style="width:200px"/>
            </Form-item>
            <Row class="button_row">
                <span style="float: left;">
                  <Button type="primary"  @click="todo(100)" icon="ios-brush">城市低保政策咨询登记</Button>
                  <Button type="primary" class="button_item_left" @click="todo(200)"
                          icon="md-remove-circle">农村低保政策咨询登记</Button>
                </span>
                <span style="float: right;">
                <Button type="primary"  @click="searchQuery">查询</Button>
                 <Button type="primary" class="button_item_left" @click="searchReset">重置</Button>
                     </span>
            </Row>
        </Form>

        <div class="table_div">
            <vxe-table border
                       resizable
                       row-id="id"
                       :row-key="true"
                       show-overflow="tooltip"
                       align="center"
                       header-align="center"
                       ref="xTree"
                       :loading="Loading"
                       :radio-config="{highlight: true}"
                       @cell-click="selectChange"
                       :data="tableData">
                <vxe-table-column type="radio" width="60" align="center" fixed="left"/>
                <vxe-table-column field="azcp0003" title="申请人姓名" align="center" width="100" fixed="left"/>
                <vxe-table-column field="azcp0002" title="申请人证件类型" align="center" width="160" fixed="left"/>
                <vxe-table-column field="azcp0001" title="申请人身份证号码" align="center" width="180" fixed="left"/>
                <vxe-table-column field="azdf0500" title="申请人户籍地" align="center" width="140"/>
                <vxe-table-column field="azdf0008" title="家庭住址" align="center" width="140"/>
                <vxe-table-column field="ssca0002_name" title="申请救助类型" align="center" width="120"/>
                <vxe-table-column field="create_by" title="登记人" align="center" width="100"/>
                <vxe-table-column field="azaa0002" title="登记咨询行政属地" align="center" width="140"/>
                <vxe-table-column field="delFlag" title="状态" align="center" width="140"/>
                <vxe-table-column field="create_date" title="咨询时间" align="center" width="140" :formatter="renderTime"/>
                <vxe-table-column title="操作" align="center" width="170" fixed="right">
                    <template #default="{row}">
                        <Button type="default" @click="edit(row)">编辑</Button>
                        <Button type="default" @click="deleteSs11001(row)">删除</Button>
                    </template>
                </vxe-table-column>
            </vxe-table>
            <Page :total="dataCount" :page-size="pageSize" show-total class="paging"
                  @on-change="handleTableChange"></Page>
        </div>
        <application-modal ref="modal"/>
    </div>
</template>

<script>
    import {CommonMixin} from '@/views/common/js/CommonMixin'
    import {getAction, postAction} from '@/api/request'

    import applicationModal from './applicationModal'

    export default {
        name: "ss11000ListZixun",
        components: {applicationModal},
        mixins: [CommonMixin],
        data() {
            return {
                key: "",
                width: 1200,
                title: '',
                visible: false,
                queryParam: {},
                conversionTypes: [],
                Loading: true,
                show: false,
                selectRow: null,
                url: {
                    list: "/api/ac/subsistence/ss11000Service/findZixunPageList",
                },
                dictList: [],
            }
        },
        created() {
            this.loadData(1);
        },
        methods: {
            deleteSs11001(record) {
                this.$Modal.confirm({
                    title: '确定删除该数据吗？',
                    onOk: () => {
                        let url = '/api/ac/subsistence/ss11000Service/deleteSS11000';
                        let dataParam = {ss11001Id: record.ss11001Id}
                        postAction(url, dataParam).then((res) => {
                            this.selectRow = null;
                            // 新增/修改 成功时，重载列表
                            this.loadData();
                        });
                    }
                })

            },
            selectChange({row}) {
                this.$refs.xTree.setRadioRow(row);
                this.selectRow = row;
            },
            cancel() {
                this.visible = false;
            },
            loadData(arg) {
                if (arg == 1) {
                    this.pageNo = 1;
                }
                let that = this;
                that.Loading = true;
                let param = Object.assign({}, this.queryParam);
                let url = this.url.list;
                param.pageNo = this.pageNo;
                param.pageSize = this.pageSize;
                postAction(url, param).then((res) => {
                    if (res.data.errcode != 0) {
                        this.$Message.error(res.data.errmsg);
                    } else {
                        that.tableData = res.data.data.results;
                        that.dataCount = res.data.data.totalRecord;
                    }
                }).finally(() => {
                    that.Loading = false;
                })
            }, edit(record) {
                this.title = '城市低保政策咨询登记';
                var width = this.$refs.body.clientWidth;
                this.$nextTick(() => {
                    this.$refs.modal.edit(record);
                    this.$refs.modal.width = width + 100;
                    this.$refs.modal.key = this.uuid();
                });
            },
            todo(type) {
                this.title = '城市低保政策咨询登记';
                if (type == '200') {
                    this.title = '农村低保政策咨询登记';
                }
                let dataParam = {
                    ssca0002: type,
                    azcp0001: '',
                }
                var width = this.$refs.body.clientWidth;
                this.$nextTick(() => {
                    this.$refs.modal.edit(dataParam);
                    this.$refs.modal.width = width + 100;
                    this.$refs.modal.key = this.uuid();
                });
            },
            searchDetail(row) {
                row.processinstid = row.ywgl004;
                var width = this.$refs.body.clientWidth;
                this.$refs.modal.edit(row);
                this.$refs.modal.width = width + 40;
            },
            modalFormOk() {
                this.selectRow = null;
                // 新增/修改 成功时，重载列表
                this.loadData();
            },
        },

    }
</script>

<style scoped>
    .paging {
        float: right;
        margin-top: 10px;
    }

    /deep/ .ivu-upload-list {
        display: none;
    }

    /deep/ .ivu-table-cell {
        padding-right: 0px;
        padding-left: 0px;
    }

    /deep/ .ivu-modal-footer {
        border-top: 0px;
        padding: 0px;
    }

    #statistics {
        height: 50px;
        line-height: 50px;
        width: 100%;
        color: red;
        font-size: 16px;
    }

    #statistics span {
        padding-left: 10px;
        padding-right: 10px;
    }

</style>
